import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Question6 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();
        int[] num = new int[n];
        int x, y;

        long tol = 0;

        for (int i = 0; i < n; i++) {
            num[i] = in.nextInt();
            tol += num[i]; 
        }

        x = in.nextInt();
        y = in.nextInt();

        if (x > y) {
            int temp = x;
            x = y;
            y = temp;
        }

        long dist1 = 0;

        for (int i = x; i < y; i++) {
            dist1 += num[i - 1];
        }

        long dist2 = tol - dist1;

        System.out.println(Math.min(dist1, dist2));
    }
}